package pl.edu.agh.lab2.sr.main;

import java.rmi.Naming;
import java.rmi.server.UnicastRemoteObject;

import pl.edu.agh.lab2.sr.server.BattleshipServer;
import pl.edu.agh.lab2.sr.server.IBattleshipServer;

public class SampleServer {

	static BattleshipServer server;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// if (System.getSecurityManager() == null) {
		// System.setSecurityManager(new SecurityManager());
		// }
		try {
			server = new BattleshipServer();
			String battleshipServerObjectPath = "rmi://127.0.0.1:1099/battleship";

			IBattleshipServer exportedSrv = (IBattleshipServer) UnicastRemoteObject
					.exportObject(server, 0);

			Naming.rebind(battleshipServerObjectPath, exportedSrv);
		} catch (Exception e) {
			System.err.println(e.toString());
		}
	}

}
